<html>
<head>
<title>注册新用户</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<link rel = "stylesheet" href = "sidebar.css" type = "text/css" />
<link rel = "stylesheet" href = "header.css" type = "text/css" />
<link rel = "stylesheet" href = "reg2.css" type = "text/css" />
<script src = "jquery-1.7.1.js"></script>
<script>
	$(function(){
		$("#new_user").focus();
	});
</script>
<script language="javascript">
	function check_reg(form){
		
		if(form.new_user.value==""){
			alert("请输入用户名");
			form.new_user.focus();
			return(false);
		}

		if(form.new_password.value==""){
			alert("请输入密码");
			form.new_password.focus();
			return(false);
		}

		if(form.re_password.value==""){
			alert("再次输入密码");
			form.re_password.focus();
			return(false);
		}

		if(form.new_email.value==""){
			alert("请输入邮箱地址");
			form.new_email.focus();
			return(false);
		}

		if(form.new_password.value!=form.re_password.value){
			alert("两次密码不一致，请重新输入");
			form.new_password.focus();
			return(false);
		}

		if(form.new_password.value.length<6){
			alert("密码不能少于6位");
			form.new_password.focus();
			return(false);
		}

		if(form.new_user.value.length<4){
			alert("用户名至少要4位");
			form.new_user.focus();
			return(false);
		}

		if(form.new_email.value.match(/^(.+)@(.+)$/)==null){
			alert("请输入正确的email地址");
			form.new_email.focus();
			return(false);
		}
		
		return(true);


	}
</script>

</head>
<body>
<?php include_once("header.php"); ?>
<?php include_once("sidebar.php"); ?>

<div class = "reg2">
<h1>新用户注册</h1>
<table>
<form name = "reg_form" class = "reg_form" action="reg_save2.php" method="post" id = "reg_form" onsubmit="return check_reg(this);" >
	<tr>
		<td>用户名：</td>
		<td><input type = "text" name = "new_user" id = "new_user"></td>
		<td>*</td>
	</tr>
	<tr>
		<td>密码：</td>
		<td><input type = "password" name = "new_password" ></td>
		<td>*</td>
	</tr>
	<tr>
		<td>重复密码：</td>
		<td><input type = "password" name = "re_password" ></td>
		<td>*</td>
	</tr>
	<tr>
		<td>邮箱：</td>
		<td><input type = "text" name = "new_email" ></td>
		<td>*</td>
	</tr>
	<tr>
		<td>性别：</td>
		<td><select name="new_sex"><option value="1" >男</option><option value="0">女</option></select></td>
		<td>*</td>
	</tr>
	<tr>
		<td>学号：</td>
		<td><input type = "text" name = "new_xuehao" ></td>
	</tr>
	<tr>
		<td></td>
		<td><input type = "submit" value = "注册" onclick="check_reg(reg_form)">&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type = "reset" value = "重新输入" ></td>
	</tr>
</form>
</table>
</div>

</body>
</html>	